<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Introduction - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.date.introduction.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.date.introduction.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.date.html">Zend_Date</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.date.html">Zend_Date</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.date.definition.theory.html">Theory of Operation</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.date.introduction" class="section"><div class="info"><h1 class="title">Introduction</h1></div>
    

    <p class="para">
        The <span class="classname">Zend_Date</span> component offers a detailed, but simple
        <acronym class="acronym">API</acronym> for manipulating dates and times. Its methods accept a wide variety
        of types of information, including date parts, in numerous combinations yielding many
        features and possibilities above and beyond the existing <acronym class="acronym">PHP</acronym> date related
        functions. For the very latest manual updates, please see <a href="http://framework.zend.com/wiki/display/ZFDOCDEV/Home" class="link external">&raquo; our online manual (frequently
            synced to Subversion)</a>.
    </p>

    <p class="para">
        Although simplicity remains the goal, working with localized dates and times while
        modifying, combining, and comparing parts involves some unavoidable complexity. Dates, as
        well as times, are often written differently in different locales. For example, some place
        the month first, while other write the year first when expressing calendar dates. For more
        information about handling localization and normalization, please refer to <a href="zend.locale.date.datesandtimes.html" class="link"><span class="classname">Zend_Locale</span></a>.
    </p>

    <p class="para">
        <span class="classname">Zend_Date</span> also supports abbreviated names of months in many
        languages. <span class="classname">Zend_Locale</span> facilitates the normalization of localized
        month and weekday names to timestamps, which may, in turn, be shown localized to other
        regions.
    </p>

    <div class="section" id="zend.date.setdefaulttimezone"><div class="info"><h1 class="title">Always Set a Default Timezone</h1></div>
        

        <p class="para">
            Before using any date related functions in <acronym class="acronym">PHP</acronym> or Zend Framework,
            first make certain your application has a correct default timezone, by either setting
            the TZ environment variable, using the <span class="property">date.timezone</span>
            <var class="filename">php.ini</var> setting, or using <a href="http://php.net/date_default_timezone_set" class="link external">&raquo; date_default_timezone_set()</a>.
            In <acronym class="acronym">PHP</acronym>, we can adjust all date and time related functions to work for
            a particular user by setting a default timezone according to the user&#039;s expectations.
            For a complete list of timezone settings, see the <a href="http://unicode.org/cldr/data/diff/supplemental/territory_containment_un_m_49.html" class="link external">&raquo; CLDR
                Timezone Identifier List</a>.
        </p>

        <div class="example" id="zend.date.setdefaulttimezone.example-1"><div class="info"><p><b>Example #1 Setting a Default Timezone</b></p></div>
            

            <pre class="programlisting brush: php">
// timezone for an American in California
date_default_timezone_set(&#039;America/Los_Angeles&#039;);
// timezone for a German in Germany
date_default_timezone_set(&#039;Europe/Berlin&#039;);
</pre>

        </div>

        <p class="para">
            <em class="emphasis">When creating <span class="classname">Zend_Date</span> instances, their timezone will
            automatically become the current default timezone!</em> Thus, the timezone setting
            will account for any Daylight Savings Time (<acronym class="acronym">DST</acronym>) in effect,
            eliminating the need to explicitly specify <acronym class="acronym">DST</acronym>.
        </p>

        <p class="para">
            Keep in mind that the timezones <em class="emphasis"><acronym class="acronym">UTC</acronym></em> and
            <em class="emphasis"><acronym class="acronym">GMT</acronym></em> do not include Daylight Saving Time. This
            means that even if you define per hand that <span class="classname">Zend_Date</span> should work
            with <acronym class="acronym">DST</acronym>, it would automatically be switched back for the instances
            of <span class="classname">Zend_Date</span> which have been set to <acronym class="acronym">UTC</acronym> or
            <acronym class="acronym">GMT</acronym>.
        </p>
    </div>

    <div class="section" id="zend.date.why"><div class="info"><h1 class="title">Why Use Zend_Date?</h1></div>
        

        <p class="para">
            <span class="classname">Zend_Date</span> offers the following features, which extend the scope
            of <acronym class="acronym">PHP</acronym> date functions:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    Simple <acronym class="acronym">API</acronym>
                </p>

                <p class="para">
                    <span class="classname">Zend_Date</span> offers a very simple <acronym class="acronym">API</acronym>,
                    which combines the best of date and time functionality from four programming
                    languages. It is possible, for example, to add or compare two times within a
                    single row.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    Completely internationalized
                </p>

                <p class="para">
                    All full and abbreviated names of months and weekdays are supported for more
                    than 130 languages. Methods support both input and the output of dates using the
                    localized names of months and weekdays, in the conventional format associated
                    with each locale.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    Unlimited timestamps
                </p>

                <p class="para">
                    Although <acronym class="acronym">PHP</acronym> 5.2 docs state, &quot;The valid range of a timestamp
                    is typically from Fri, 13 Dec 1901 20:45:54 <acronym class="acronym">GMT</acronym> to Tue, 19
                    Jan 2038 03:14:07 <acronym class="acronym">GMT</acronym>,&quot; <span class="classname">Zend_Date</span>
                    supports a nearly unlimited range, with the help of the BCMath extension. If
                    BCMath is not available, then <span class="classname">Zend_Date</span> will have reduced
                    support only for timestamps within the range of the float type
                    supported by your server. &quot;The size of a float is platform-dependent, although a
                    maximum of <strong class="command">~1.8e308</strong> with a precision of roughly 14 decimal
                    digits is a common value (that&#039;s 64 bit <acronym class="acronym">IEEE</acronym> format).&quot; [
                    <a href="http://www.php.net/float" class="link external">&raquo; http://www.php.net/float</a> ].
                    Additionally, inherent limitations of float data types, and rounding error of
                    float numbers may introduce errors into calculations. To avoid these problems,
                    Zend Framework&#039;s I18n components use BCMath extension, if available.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    Support for <acronym class="acronym">ISO-8601</acronym> date specifications
                </p>

                <p class="para">
                    <acronym class="acronym">ISO-8601</acronym> date specifications are supported. Even partially
                    compliant <acronym class="acronym">ISO-8601</acronym> date specifications will be identified.
                    These date formats are particularly useful when working with databases. for
                    example, even though MsSQL and <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html" class="link external">&raquo; MySQL</a>
                    differ a little from each other, both are supported by
                    <span class="classname">Zend_Date</span> using the <a href="zend.date.constants.html#zend.date.constants.list" class="link">Zend_Date::ISO_8601</a> format
                    specification constant. When date strings conform to &quot;<strong class="command">Y/m/d</strong>&quot;
                    or &quot;<strong class="command">Y-m-d H:i:s</strong>&quot;, according to <acronym class="acronym">PHP</acronym>
                     <span class="methodname">date()</span> format tokens, use
                    <span class="classname">Zend_Date</span>&#039;s built-in support for
                    <acronym class="acronym">ISO-8601</acronym> formatted dates.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    Calculate sunrise and sunset
                </p>

                <p class="para">
                    For any place and day, the times for sunrise and sunset can be displayed, so
                    that you won&#039;t miss a single daylight second for working on your favorite
                    <acronym class="acronym">PHP</acronym> project :)
                </p>
            </li>
        </ul>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.date.html">Zend_Date</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.date.html">Zend_Date</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.date.definition.theory.html">Theory of Operation</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.date.html">Zend_Date</a></li>
  <li class="active"><a href="zend.date.introduction.html">Introduction</a></li>
  <li><a href="zend.date.definition.theory.html">Theory of Operation</a></li>
  <li><a href="zend.date.basic.html">Basic Methods</a></li>
  <li><a href="zend.date.overview.html">Zend_Date API Overview</a></li>
  <li><a href="zend.date.creation.html">Creation of Dates</a></li>
  <li><a href="zend.date.constants.html">Constants for General Date Functions</a></li>
  <li><a href="zend.date.additional.html">Working Examples</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>